#ifndef DESKTOP_FEATURE_CONNECTION_H
#define DESKTOP_FEATURE_CONNECTION_H

class FdoIConnection;

class MgResourceIdentifier;

template class Ptr<MgResourceIdentifier>;

class MgFeatureConnection : public MgGuardDisposable
{
public:

    MgFeatureConnection(MgResourceIdentifier* featureSourceIdentifier);
    MgFeatureConnection(CREFSTRING providerName, CREFSTRING connectionString);
    virtual ~MgFeatureConnection();

private:

    MgFeatureConnection();

    void Initialize();
    void Close();

public:

    virtual void Dispose();

    FdoIConnection* GetConnection();
    STRING GetProviderName();

    bool IsConnectionOpen();
    bool IsConnectionBusy();
    bool IsConnectionClosed();
    bool IsConnectionPending();

    bool SupportsCommand(INT32 commandType);

    void OwnReader();

private:

    FdoIConnection* m_fdoConn;
    Ptr<MgResourceIdentifier> m_resourceId;
    bool m_bCloseConnection;
};

#endif